﻿using System;
using System.Timers;

public class Clock
{
    private static System.Timers.Timer clock;

    public static void Main()
    {
        Console.CursorVisible = false;
        Console.ForegroundColor = ConsoleColor.DarkGreen;
        Console.SetWindowSize(19, 1);        
        clock = new System.Timers.Timer();
        clock.Elapsed += new ElapsedEventHandler(OnTimedEvent);
        clock.Interval = 1000;
        begin:
        clock.Enabled = true;
        if (Console.ReadKey().Key != ConsoleKey.Escape) goto begin;
    }

    private static void OnTimedEvent(object source, ElapsedEventArgs e)
    {
        Console.Clear();
        Console.Write(e.SignalTime);
    }
}